home *** CD-ROM | disk | FTP | other *** search
-
-
-
- #include <Types.h>
- #include <Patches.h>
- #include <CodeFragments.h>
- #include <Sound.h>
-
- void MySysBeepPatch(SInt16 duration);
- void DoSomePreprocessing(void);
- void DoSomePostprocessing(void);
-
- enum {
- kMyPatchCount = 1 /* Number of patches in my list */
- };
-
- /* One patch description per patch */
- PatchDescription gSysBeepPatchDescription = {
- &SysBeep,
- &MySysBeepPatch,
- {'wild',
- 'demo'},
- {
- kNilOptions,
- { kDoNotMatchAnyOrderedItemService,
- kDoNotMatchAnyOrderedItemSignature},
- { kDoNotMatchAnyOrderedItemService,
- kDoNotMatchAnyOrderedItemSignature}
- },
- kPatchEnabledMask,
- paramErr,
- kInvalidID,
- NULL,
- kInvalidID
- };
-
- /* The table with the list of patch descriptions; this one includes
- only one patch */
- PatchDescription * gPatchDescriptionList[kMyPatchCount] = {
- &gSysBeepPatchDescription };
-
- /* The Patch header. This is exported as the patch fragment's main entry point. */
- PatchHeader gPatchData =
- {
- kPatchHeaderTag,
- kPatchHeaderVersion,
- kNilOptions,
- kMyPatchCount,
- &gPatchDescriptionList[0]
- };
-
-
-
- /* Do some preprocessing here */
- void DoSomePreprocessing(void)
- {
- /* Put preprocessing code here */
- Debugger();
- }
-
- void DoSomePostprocessing(void)
- {
- /* Put postprocessing code here */
- Debugger();
- }
-
- typedef void (*SysBeepPatchProcPtr)(SInt16 duration);
-
- /* The patch itself.
- Does some preprocessing,
- calls through the rest of the patch chain, and
- then does some postprocessing. */
- void MySysBeepPatch(SInt16 duration)
- { DoSomePreprocessing();
-
- /* Call the routine that handles the chaining*/
- (* (SysBeepPatchProcPtr)
- gSysBeepPatchDescription.thisCallThroughProc) (duration);
-
- DoSomePostprocessing();
-
- return;
- }
-
- /* CFM init routine.
- Do not proceed if the patch could not be installed. */
-
- OSErr InitMyPatch(const CFragInitBlock *initBlock)
- {
- return (gSysBeepPatchDescription.installResult);
- }
-